import request from '@/utils/request'


// 获取优惠券分页列表
export function listConfig (query) {
    return request({
        url: '/store/promotion/coupon',
        method: 'get',
        params: query
    })
}

//获取优惠券列表
export function listCoupon (query) {
    return request({
        url: '/store/promotion/coupon/list',
        method: 'get',
        params: query
    })
}

// 新增优惠券
export function addConfig (data) {
    return request({
        url: '/store/promotion/coupon',
        method: 'POST',
        data: data
    })
}

// 修改优惠券
export function updateConfig (data) {
    return request({
        url: '/store/promotion/coupon',
        method: 'put',
        data: data
    })
}


// 紧急关闭优惠券 /dev-api/store/promotion/coupon/{id}/close
export function deleteConfig (id) {
    return request({
        url: `/store/promotion/coupon/${id}/close`,
        method: 'delete',
    })
}


//获取优惠券屏蔽的商品列表
export function listExcludeSku (id, query) {
    return request({
        url: `/store/promotion/coupon/${id}/exclude/skus`,
        method: 'get',
        params: query
    })
}
